//
//  DemoTestTests.m
//  DemoTestTests
//
//  Created by DaShuEdu on 2017/4/24.
//  Copyright © 2017年 DaShuEdu. All rights reserved.
//

#import <XCTest/XCTest.h>

@interface DemoTestTests : XCTestCase

@end

@implementation DemoTestTests

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // cityData.plist
    NSLog(@"HomePath:%@",NSHomeDirectory());
    NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"cityData" ofType:@"plist"];
    NSDictionary *cityList = [NSDictionary dictionaryWithContentsOfFile:plistPath];
    NSMutableArray *cityMutiArr = [NSMutableArray arrayWithCapacity:300];
    
    for (NSArray *cityArr in [cityList allValues]) {
        for (NSString *cityName in cityArr) {
            if (![cityName isEqualToString:@"不限"] && ![cityName hasSuffix:@"区"]) {
                [cityMutiArr addObject:cityName];
            }
        }
    }
    NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    NSString *filePath = [documentPath stringByAppendingPathComponent:@"city.plist"];
    [cityMutiArr writeToFile:filePath atomically:YES];
}

- (void)testPerformanceExample {
    // This is an example of a performance test case.
    [self measureBlock:^{
        // Put the code you want to measure the time of here.
    }];
}

@end
